import 'package:gold/generated/json/base/json_field.dart';
import 'package:gold/generated/json/goods_detail_model.g.dart';
import 'dart:convert';
export 'package:gold/generated/json/goods_detail_model.g.dart';

@JsonSerializable()
class GoodsDetailModel {
	/// 商品ID
	int? id;
	/// 店铺ID
	@JSONField(name: 'shop_id')
	int? shopId;
	/// 分类ID
	@JSONField(name: 'category_id')
	int? categoryId;
	/// 商品名
	String? name;
	/// 封面图
	@JSONField(name: 'cover_image')
	String? coverImage;
	/// 顶部轮播图
	@JSONField(name: 'image_urls')
	String? imageUrls;
	/// 比价上方的描述
	String? description;
	/// 底部购买按钮上方的描述
	@JSONField(name: 'description_bottom')
	String? descriptionBottom;
	/// 价格
	double? price;
	/// 积分购买价格
	@JSONField(name: 'points_price')
	double? pointsPrice;
	/// 市场价
	@JSONField(name: 'market_price')
	double? marketPrice;
	/// 库存（件）黄金投资商品单位为（克）
	int? stock;
	/// 销量
	int? sales;
	/// 标签
	String? tags;
	/// 限购数量 0为不限购
	int? limit;
	/// 赠送积分数
	@JSONField(name: 'reward_points')
	double? rewardPoints;
	/// 全网比价json数据
	String? peer;
	/// 运费金额
	double? freight;
	/// 运费说明
	@JSONField(name: 'freight_notes')
	String? freightNotes;
	/// 富文本详情
	String? content;
	/// 商品类型 product=购物,gold=黄金,points=积分
	String? type;
	/// 店铺信息
	ShopInfoModel? shop;
	/// 创建时间
	@JSONField(name: 'created_at')
	String? createdAt;
	/// 修改时间
	@JSONField(name: 'updated_at')
	String? updatedAt;

	GoodsDetailModel();

	factory GoodsDetailModel.fromJson(Map<String, dynamic> json) => $GoodsDetailModelFromJson(json);

	Map<String, dynamic> toJson() => $GoodsDetailModelToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}

@JsonSerializable()
class ShopInfoModel {
	/// 销量
	int? id;
	/// 销量
	String? name;
	/// 销量
	@JSONField(name: 'logo_url')
	String? logoUrl;

	ShopInfoModel();

	factory ShopInfoModel.fromJson(Map<String, dynamic> json) => $ShopInfoModelFromJson(json);

	Map<String, dynamic> toJson() => $ShopInfoModelToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}